home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11014 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: news.luc.edu!user
  2. From: VArase@varase.it.luc.edu (Verne Arase)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: HELP. How to convert '0x12' into FF char?
  5. Date: Thu, 21 Mar 1996 08:44:08 -0600
  6. Organization: LUMC
  7. Message-ID: <AD76C75896683B250@mcdialb11.it.luc.edu>
  8. References: <4iissm$s76@nntp.ucs.ubc.ca> <17MAR199623533662@erich.triumf.ca> <827344614snz@genesis.demon.co.uk>
  9. NNTP-Posting-Host: 147.126.240.127
  10.  
  11. In article <827344614snz@genesis.demon.co.uk>,
  12. Lawrence Kirby <fred@genesis.demon.co.uk> wrote:
  13.  
  14.  >>>f='0x';
  15.  >>>strcpy(f,d);
  16.  >>>strcpy(f,e);
  17.  >>> 
  18.  >>>f now contains the string '0x12' right?
  19.  >>
  20.  >>No.
  21.  >
  22.  >Indeed, it isn't even legal code.
  23.  
  24. Well, it's probably not legal (or at least suffers from suspicious pointer
  25. conversion).
  26.  
  27. What this would probably end up doing is copying characters until the first
  28. NUL charcter is found from absolute memory location 0x00000032 (if ASCII)
  29. or 0x000000F1 (if EBCDIC).
  30.  
  31.  >>but if you have:
  32.  >>        char f[10] = "0x";
  33.  >>        char d[2] = "1";
  34.  >>        char e[2] = "2";
  35.  >>        strcpy(f,d);
  36.  >>        strcpy(f,e);
  37.  >
  38.  >I assume you mean strcat() here.
  39.  
  40. strcat(), like strcpy(), works with character _pointers.
  41.  
  42. ---
  43. The above are my own opinions, and not those of my employer.
  44.